#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "TemplateParameter.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class Classifier;

/// <summary>
/// ClassifierTemplateParameter
/// A ClassifierTemplateParameter exposes a Classifier as a formal template
/// parameter.
/// </summary>
class UMLMODEL_EXPORT ClassifierTemplateParameter : public TemplateParameter {

public: // Constructors and destructors
    explicit ClassifierTemplateParameter(const QString& umlType="uml::ClassifierTemplateParameter");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// allowSubstitutable getter
    /// Constrains the required relationship between an actual parameter and the
    /// parameteredElement for this formal parameter.
    /// </summary>
    bool allowSubstitutable() const;

    /// <summary>
    /// allowSubstitutable setter
    /// Constrains the required relationship between an actual parameter and the
    /// parameteredElement for this formal parameter.
    /// </summary>
    void setAllowSubstitutable(bool value);

    /// <summary>
    /// constrainingClassifiers getter
    /// The classifiers that constrain the argument that can be used for the parameter.
    /// If the allowSubstitutable attribute is true, then any Classifier that is
    /// compatible with this constraining Classifier can be substituted; otherwise, it
    /// must be either this Classifier or one of its specializations. If this property
    /// is empty, there are no constraints on the Classifier that can be used as an
    /// argument.
    /// </summary>
    vector<shared_ptr<Classifier>>& constrainingClassifiers();

    /// <summary>
    /// parameteredElement getter
    /// The Classifier exposed by this ClassifierTemplateParameter.
    /// </summary>
    shared_ptr<Classifier> parameteredElement() const;

    /// <summary>
    /// parameteredElement setter
    /// The Classifier exposed by this ClassifierTemplateParameter.
    /// </summary>
    void setParameteredElement(shared_ptr<Classifier> value);

private: // Fields
    /// <summary>
    /// allowSubstitutable
    /// Constrains the required relationship between an actual parameter and the
    /// parameteredElement for this formal parameter.
    /// </summary>
    const static bool allowSubstitutable_default_;
    bool allowSubstitutable_= allowSubstitutable_default_;

    /// <summary>
    /// constrainingClassifiers
    /// The classifiers that constrain the argument that can be used for the parameter.
    /// If the allowSubstitutable attribute is true, then any Classifier that is
    /// compatible with this constraining Classifier can be substituted; otherwise, it
    /// must be either this Classifier or one of its specializations. If this property
    /// is empty, there are no constraints on the Classifier that can be used as an
    /// argument.
    /// </summary>
    vector<shared_ptr<Classifier>> constrainingClassifiers_;

    /// <summary>
    /// parameteredElement
    /// The Classifier exposed by this ClassifierTemplateParameter.
    /// </summary>
    shared_ptr<Classifier> parameteredElement_;

};

} // namespace uml
